/*
 * HttpFactory.h
 *
 *  Created on: 2022-05-07
 *      Author: chuanjiang.zh
 */

#ifndef HTTPFACTORY_H_
#define HTTPFACTORY_H_

#include "HttpServer.h"
#include "HttpClient.h"
#include <memory>

typedef std::shared_ptr< HttpClient >   HttpClientPtr;
typedef std::shared_ptr< HttpServer >   HttpServerPtr;

class HttpFactory
{
public:
    HttpFactory();
    virtual ~HttpFactory();

    static HttpClient* createClient();

    static void destroyClient(HttpClient* client);

    static HttpServer* createServer();

    static void destroyServer(HttpServer* server);

    static HttpClientPtr makeClient()
    {
        return HttpClientPtr(createClient(), destroyClient);
    }

    static HttpServerPtr makeServer()
    {
        return HttpServerPtr(createServer(), destroyServer);
    }

};

#endif /* HTTPFACTORY_H_ */
